package edu.washington.math.sage;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;

import javax.swing.JPanel;

public class PyPhysSimGUIDrawingPanel extends JPanel{
	PPSMouseListener myPPSMouseListener;
	PyPhysSimGui myParentGui;
    public PyPhysSimGUIDrawingPanel(PyPhysSimGui theParentGui){
    	super();
        myPPSMouseListener =
            new PPSMouseListener();
        myParentGui=theParentGui;
    	this.addMouseMotionListener(myPPSMouseListener);
        this.addMouseListener(myPPSMouseListener);
    	this.setBackground(Color.white);
    	this.setForeground(Color.blue);
    	this.setPreferredSize(new Dimension(500,500));
    }
    public void paintComponent(Graphics g){
    	super.paintComponent(g);
    	//I used http://java.sun.com/docs/books/tutorial/2d/geometry/arbitrary.html as a resource on drawing paths
    	Graphics2D g2 = (Graphics2D) g;
    	for (String key:myParentGui.myPaths.keySet()){
    		g2.setColor(myParentGui.myColors.get(key));
    		g2.draw(myParentGui.myPaths.get(key));
    	}
    }
}
